# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Ronald van Haren <ronald.archlinux.org>

pkgname=calligra
pkgdesc="A set of applications for productivity and creative usage"
pkgver=3.1.0
pkgrel=9
arch=(x86_64)
url='https://www.calligra-suite.org/'
license=(FDL1.2 GPL2 LGPL)
depends=(kcmutils knotifyconfig kross kactivities kdiagram libspnav kdelibs4support
         gsl openexr kcontacts qca-qt5 poppler-qt5 libodfgen qt5-webkit cauchy khtml)
makedepends=(extra-cmake-modules kdoctools kdesignerplugin boost openjpeg akonadi-contacts
             libwpg okular eigen marble-common pstoedit libvisio libetonyek libwps vc libgit2)
optdepends=('libwpg: Corel WordPerfect Graphics image importer'
            'libwps: Microsoft Works file word processor format import'
            'libvisio: Microsoft Visio import filter'
            'libetonyek: Apple Keynote import filter'
            'pstoedit: EPS to SVG filter'
            'poppler: PDF to SVG filter'
            'openjpeg: PDF to SVG filer'
            'libgit2: Calligra Gemini git plugin'
            'kirigami2: for Calligra Gemini'
            'qt5-quickcontrols: for Calligra Gemini'
            'qt5-webengine: for Calligra Gemini')
conflicts=(calligra-devtools calligra-extras calligra-filters calligra-karbon karbon calligra-libs
           calligra-plugins calligra-sheets calligra-stage calligra-words calligra-l10n calligra-meta
           calligra-flow calligra-braindump calligra-gemini calligra-handbook)
replaces=(calligra-devtools calligra-extras calligra-filters calligra-karbon karbon calligra-libs
          calligra-plugins calligra-sheets calligra-stage calligra-words calligra-l10n calligra-meta)
for _lang in bs ca ca@valencia cs da de el en_gb es et fi fr gl hu it ja kk nb nl \
             pl pt pt_br ru sk sv uk zh_cn zh_tw; do
  conflicts+=(calligra-l10n-$_lang)
  replaces+=(calligra-l10n-$_lang)
done
source=("https://download.kde.org/stable/$pkgname/$pkgver/$pkgname-$pkgver.tar.xz"{,.sig}
        calligra-qt5.11.patch)
sha256sums=('6818cd6e64136321be217eb57cc7d6ac7c7035191fdb1ee336ebe60bc114e870'
            'SKIP'
            '40ac9fabed8e13c31f6f243bd7e9083c3ec322568991ba84987106b982ffc10a')
validpgpkeys=(05D00A8B73A686789E0A156858B9596C722EA3BD  # Boudewijn Rempt <foundation@krita.org>
              42A60D06F449E895F40F09C01638B8A616108B8A) # Dag Andersen <danders@get2net.dk>

prepare() {
  mkdir -p build

  cd $pkgname-$pkgver
# Fix build with Qt 5.11
  patch -p1 -i ../calligra-qt5.11.patch
}

build() {
  cd build
  cmake ../$pkgbase-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DBUILD_TESTING=OFF
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
}
